<template>
	<view>
		<view class="content">
			<view>
				<u-tabs :list="tablist" lineColor="#0bc5ae" :current="current" :activeStyle="{
                    fontWeight: 'bold',
                }" :scrollable="false" @click="click"></u-tabs>
			</view>
			<view v-if="current==0" class="card-container-view">
				<view class="card-view">
					<view class="body">
						<view class="list-item">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill">
							</image>
							<view class="content-view">
								<view class="title">王医生1</view>
								<view class="content three-line-ellipsis">
									疼痛科，颈椎病
								</view>
							</view>
						</view>
						<view class="list-item">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill"></image>
							<view class="content-view">
								<view class="title">王医生2</view>
								<view class="content three-line-ellipsis">
									疼痛科，颈椎病
								</view>
							</view>
						</view>
						<view class="list-item">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill"></image>
							<view class="content-view">
								<view class="title">王医生3</view>
								<view class="content three-line-ellipsis">
									疼痛科，颈椎病
								</view>
							</view>
						</view>
					</view>
					<view class="footer">没有更多了</view>
				</view>
			</view>
			<view v-if="current==1" class="card-container-view">
				<view class="card-view">
					<view class="body">
						<view class="list-item">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill"></image>
							<view class="content-view">
								<view class="title">王医生4</view>
								<view class="content three-line-ellipsis">
									疼痛科，颈椎病
								</view>
							</view>
						</view>
						<view class="list-item">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill"></image>
							<view class="content-view">
								<view class="title">王医生5</view>
								<view class="content three-line-ellipsis">
									疼痛科，颈椎病
								</view>
							</view>
						</view>
						<view class="list-item">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill"></image>
							<view class="content-view">
								<view class="title">王医生6</view>
								<view class="content three-line-ellipsis">
									疼痛科，颈椎病
								</view>
							</view>
						</view>
					</view>
					<view class="footer">没有更多了</view>
				</view>
			</view>
			<view v-if="current==2" class="card-container-view">
				<view class="card-view">
					<view class="body">
						<view v-for="(item, index) in gridList" :key="index" class="list-item" @click="goYS()">
							<image
								src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
								class="list-img" mode="aspectFill" @click="handleImageClick">
							</image>
							<view class="content-view">
								<view class="title">{{ item.name }}</view>
								<view class="content three-line-ellipsis">
									{{ item.departmentName }}
								</view>
							</view>
						</view>
					
					</view>
					<view class="footer">没有更多了</view>
				</view>
			</view>
			<view v-if="current==3" class="list" v-for="item in teams" :key="item.institutionUid">
				<image class="list-img"
					src="https://fastly.picsum.photos/id/663/200/300.jpg?hmac=OYPBwsRmaygvAiTN0M4ZNNWBZqgbTGuH2aXkJ4FLX_M"
					mode="aspectFill" @click="goYY(item)"></image>
				<view class="list-right">
					<view class="list-tit">
						{{ item.name }}
					</view>
					<view class="list-item">
						<view class="">评分：4.9分</view>
						<view class="">37条</view>
					</view>
					<view class="list-item">地区：{{ item.areaName }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		   getDoctorList
		} from '../../api/index.js'
	export default {
		components: {},
		data() {
			return {
				messagequery: {
				  pageNumber: 1, //	必选	Integer	页数
				  pageSize: 10, //	必选	Integer	每页显示的数量
				},
				tablist: [{
					name: '热门',
					disabled: false
				}, {
					name: '最新',
					disabled: false
				}, {
					name: '医生',
					disabled: false
				}, {
					name: '团队',
					disabled: false
				}],
				gridList: [],
				teams: [{
						name: '人民医院',
						areaName: '雁塔区',
						institutionUid: '1'
					},
					{
						name: '附属二院',
						areaName: '莲湖区',
						institutionUid: '2'
					},
					{
						name: '附属二院',
						areaName: '莲湖区',
						institutionUid: '3'
					},
					{
						name: '附属二院',
						areaName: '莲湖区',
						institutionUid: '4'
					}
				],
				current: 2
			}
		},
		onLoad() {},
		mounted() {
			this.initServe()
		},
		methods: {
			initServe() {
				getDoctorList(this.messagequery).then((res) => {
					let data = res.data.records
					console.log("数据", data)
					this.gridList = data
				})
			
			},
			handleImageClick() {
				uni.navigateTo({
					url: '/chronicDisease/pages/my/doctorhomepage' // 目标页面的路径
				});
			},
			goYY(data) {
				uni.navigateTo({
					url: '/chronicDisease/pages/my/team'
				});
			},
			goYS() {
				// uni.navigateTo({
				// 	url: '/chronicDisease/pages/tabs/tabs'
				// });
			},
			click(item) {
				/* console.log("item", item) */
				this.current = item.index
				//this.itemList = this.gridList[this.current].nurseServersList
			},
		},
	};
</script>

<style lang="scss" scoped>
	.card-container-view {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;

		.card-view {
			width: 100%;
			background: white;
			padding-top: 20rpx;
			border-radius: 12rpx;
			overflow: hidden;

			.title-view {
				width: 100%;
				display: flex;
				padding: 24rpx;
				box-sizing: border-box;
				justify-content: space-between;

				.title {
					color: #232323;
					font-size: 34rpx;
					font-weight: bold;
				}

				.more-btn {
					color: rgba(35, 35, 35, 0.4);
					font-size: 24rpx;
				}
			}

			.body {
				width: 100%;
				display: flex;
				flex-direction: column;

				.list-item {
					width: 100%;
					height: 230rpx;
					padding-left: 24rpx;
					padding-right: 24rpx;
					box-sizing: border-box;
					display: flex;
					align-items: center;
					border-bottom: solid 1rpx #f8f8f8;

					.list-img {
						width: 174rpx;
						height: 174rpx;
						border-radius: 20rpx;
					}

					.content-view {
						flex: 1;
						margin-left: 20rpx;
						display: flex;
						flex-direction: column;

						.title {
							color: #232323;
							font-size: 15.56px;
							font-weight: bold;
						}

						.content {
							margin-top: 20rpx;
							font-size: 13.25px;
							color: rgba(35, 35, 35, 0.7);
							margin-top: 10rpx;
							letter-spacing: 1px;
						}
					}
				}
			}

			.footer {
				height: 70rpx;
				font-size: 22rpx;
				color: rgba(35, 35, 35, 0.4);
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}

	.list {
		display: flex;
		gap: 20rpx;
		padding: 30rpx 0;
		border-bottom: 1px solid #eee;
	}

	.list-img {
		width: 240rpx;
		height: 180rpx;
		border-radius: 20rpx;
	}

	.list-right {
		width: 440rpx;
		display: flex;
		flex-direction: column;
		gap: 20rpx;
	}

	.list-item {
		display: flex;
		gap: 20rpx;
		color: #999;
	}
</style>